import * as request from "@/services/api";


// 请求成功
// const SUCCESS = '1';

export default {
  namespace: "global",
  state: {
    userId: sessionStorage.getItem("userId")
  },
  effects: {

    *getToken({ payload }, { call, put }) {
      const res = yield call(request.getUserStatus, payload);
      return res;
    },
    //用户信息
    *getUserInfo({ payload }, { call, put }) {
      const res = yield call(request.getUserInfo, payload);
      return res;
    },
    //用户
    *getOtherUserInfoList({ payload }, { call, put }) {
      const res = yield call(request.getOtherUserInfoList, payload);
      return res;
    },
    //首页--热词
    *hotWord({ payload }, { call, put }) {
      const res = yield call(request.hotWord, payload);
      return res;
    },
    //首页--特色资源
    *scientific({ payload }, { call, put }) {
      const res = yield call(request.scientific, payload);
      return res;
    },
    //首页--特色资源--展示部分资源、首页--资源统计-热点词云、首页--资源统计-学科分类、首页--资源统计
    *getScientificData({ payload }, { call, put }) {
      const res = yield call(request.getScientificData, payload);
      return res;
    },
    // 首页--资源排行
    *resourceRanking({ payload }, { call, put }) {
      const res = yield call(request.resourceRanking, payload);
      return res;
    },
    //首页--专题
    *getSpecial({ payload }, { call, put }) {
      const res = yield call(request.getSpecial, payload);
      return res;
    },
    //首页--公告通知
    *getAnnounceList({ payload }, { call, put }) {
      const res = yield call(request.getAnnounceList, payload);
      return res;
    },
    //首页--累计访问人数
    *headerInformationNum({ payload }, { call, put }) {
      const res = yield call(request.headerInformationNum, payload);
      return res;
    },
    //资源统计
    *queryStatistics({ payload }, { call, put }) {
      const res = yield call(request.queryStatistics, payload);
      return res;
    },
    //资源排行
    *queryRanking({ payload }, { call, put }) {
      const res = yield call(request.queryRanking, payload);
      return res;
    },
    //数据资产--热词
    *queryHotWord({ payload }, { call, put }) {
      const res = yield call(request.queryHotWord, payload);
      return res;
    },
    //数据资产管理列表、资源检索列表
    *queryDataAsset({ payload }, { call, put }) {
      const res = yield call(request.queryDataAsset, payload);
      return res;
    },
    //数据资产分类依据
    *queryCategory({ payload }, { call, put }) {
      const res = yield call(request.queryCategory, payload);
      return res;
    },
    //数据资产详情查看
    *queryDataDetail({ payload }, { call, put }) {
      const res = yield call(request.queryDataDetail, payload);
      return res;
    },
    //数据关联接口
    *queryAssociation({ payload }, { call, put }) {
      const res = yield call(request.queryAssociation, payload);
      return res;
    },

    //收藏添加
    *addCollection({ payload }, { call, put }) {
      const res = yield call(request.addCollection, payload);
      return res;
    },

    //收藏取消
    *deleteCollection({ payload }, { call, put }) {
      const res = yield call(request.deleteCollection, payload);
      return res;
    },
    //分享添加
    *addShare({ payload }, { call, put }) {
      const res = yield call(request.addShare, payload);
      return res;
    },
    //分享删除
    *deleteShare({ payload }, { call, put }) {
      const res = yield call(request.deleteShare, payload);
      return res;
    },

    //意见反馈接口
    *insert({ payload }, { call, put }) {
      const res = yield call(request.insert, payload);
      return res;
    },
    //帮助目录接口
    *getHelp({ payload }, { call, put }) {
      const res = yield call(request.getHelp, payload);
      return res;
    },
    //帮助文档内容
    *getHelpInfo({ payload }, { call, put }) {
      const res = yield call(request.getHelpInfo, payload);
      return res;
    },
    //获取目录下的文章
    *getHelpBycatalogId({ payload }, { call, put }) {
      const res = yield call(request.getHelpBycatalogId, payload);
      return res;
    },
    //分页内容
    *getHelpByPage({ payload }, { call, put }) {
      const res = yield call(request.getHelpByPage, payload);
      return res;
    },
    //科研软件分页
    *getScientificByPage({ payload }, { call, put }) {
      const res = yield call(request.getScientificByPage, payload);
      return res;
    },
    //科研软件详情
    *getScientificInfo({ payload }, { call, put }) {
      const res = yield call(request.getScientificInfo, payload);
      return res;
    },
    //科研软件下载
    *download({ payload }, { call, put }) {
      const res = yield call(request.download, payload);
      return res;
    },
    //科研附件下载
    *downloadN({ payload }, { call, put }) {
      const res = yield call(request.downloadN, payload);
      return res;
    },
    //科研软件下载量
    *Downloads({ payload }, { call, put }) {
      const res = yield call(request.Downloads, payload);
      return res;
    },
    //科研软件分类
    *getScientificDirs({ payload }, { call, put }) {
      const res = yield call(request.getScientificDirs, payload);
      return res;
    },
    //科研软件数据关联
    *selectBykeys({ payload }, { call, put }) {
      const res = yield call(request.selectBykeys, payload);
      return res;
    },
    //科研软件最新发布资源
    *selectByCreateTime({ payload }, { call, put }) {
      const res = yield call(request.selectByCreateTime, payload);
      return res;
    },
    //专题列表
    *selectByPage({ payload }, { call, put }) {
      const res = yield call(request.selectByPage, payload);
      return res;
    },
    //专题详情
    *selectTopicMessageById({ payload }, { call, put }) {
      const res = yield call(request.selectTopicMessageById, payload);
      return res;
    },
    //标准详细信息列表
    *getStandDetailInfoListByPage({ payload }, { call, put }) {
      const res = yield call(request.getStandDetailInfoListByPage, payload);
      return res;
    },
    //标准列表
    *getStandardInfoByPage({ payload }, { call, put }) {
      const res = yield call(request.getStandardInfoByPage, payload);
      return res;
    },
    //标准详情
    *getStandardInfo({ payload }, { call, put }) {
      const res = yield call(request.getStandardInfo, payload);
      return res;
    },
    //标准排行
    *getStandDetailInfoRank({ payload }, { call, put }) {
      const res = yield call(request.getStandDetailInfoRank, payload);
      return res;
    },
    //标准排行
    *getAssociationInfo({ payload }, { call, put }) {
      const res = yield call(request.getAssociationInfo, payload);
      return res;
    },
    //字典类型获取
    *getByType({ payload }, { call, put }) {
      const res = yield call(request.getByType, payload);
      return res;
    }
  },
  reducers: {
    saveVehicleDBList(state, active) {
      return {
        ...state,
        vehicleDBList: active.payload
      };
    }
  }
};
